
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
    <head>
        <!-- jquery -->
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        
        <!-- jqueryui -->
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
        <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" href="inc/css/addContact.css" type="text/css" />
        <script src="inc/js/setRights.js"></script>
        <script src="inc/js/bootstrap.min.js"></script>
        <link rel="stylesheet" href="inc/css/bootstrap.min.css">
        <title>Set Admin rights</title>
    </head>
    <body>
        <div id="container">
            <div class="panel panel-default">
                <div class="panel-heading">Global search</div>
                <div class="panel-body">
                    <div id="globalSearch">
                        <div class="form-group">
                            <input type="text" class="form-control" id="search-field" placeholder="pseudo">
                            <a href="#" id="search-button"> <span class="glyphicon glyphicon-search"></span> </a>
                        </div>
                        
                    </div>
                </div>
            </div>
            
            <div class="panel panel-default">
                <div class="panel-heading">Advanced search</div>
                <div class="panel-body">
                    <div id="advancedSearch">
                        <form class="form-inline" role="form">
                            <div class="form-group">
                                <label class="sr-only" for="exampleInputEmail2">First name</label>
                                <input type="text" class="form-control" id="exampleInputEmail2" placeholder="First name">
                            </div>
                            <div class="form-group">    
                                <label class="sr-only" for="exampleInputPassword2">Password</label>
                                <input type="text" class="form-control" id="exampleInputPassword2" placeholder="Last name">
                            </div>
                            <div class="form-group">    
                                <label class="sr-only" for="exampleInputPassword2">Password</label>
                                <input type="text" class="form-control" id="exampleInputPassword2" placeholder="Pseudo">
                            </div>
                        </form>
                        
                        <form class="form-inline" role="form">
                            <div class="form-group">
                                <label class="sr-only" for="exampleInputEmail2">First name</label>
                                <input type="text" class="form-control" id="exampleInputEmail2" placeholder="Location">
                            </div>
                            <div class="form-group">    
                                <label class="sr-only" for="exampleInputPassword2">Password</label>
                                <input type="text" class="form-control" id="exampleInputPassword2" placeholder="Email">
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox"> Show only administrators
                                </label>
                            </div>
                            <a href="#" ><span class="glyphicon glyphicon-search"></span></a>
                        </form>
                        
                    </div>
                </div>
            </div>
            
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div id="header">
                        <div class="checkbox" id="select-all">
                            <label>
                                <input type="checkbox"> Select All
                            </label>
                        </div>
                        <div id="add-contact-sign">
                            <span class="glyphicon glyphicon-check"></span>  Grant admin rights
                        </div>
                        <div id="remove-contact-sign">
                            <span class="glyphicon glyphicon-unchecked"></span>    Revoque admin rights
                        </div>
                        <!--
                        <div id="friend-sign">
                            <span class="glyphicon glyphicon-user"></span> friend
                        </div>
                        -->
                    </div>
                </div>
                <div class="panel-body">
                    <div id="users-contain">
                        <table id="users" class="table-striped">
                            <thead class="table-head">
                                <tr >
                                    <th>Pseudo</th>
                                    <th>Full name</th>
                                    <th>Location</th>
                                    <th>Email</th>
                                    <th>Grant/Revoke admin rights</th>
                                    <th></th>
                                    <th class="hidden">ID</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <c:forEach items="${users}" var="c">
                                        <th> ${c.user.username}</th> 
                                        <th> ${c.user.name} ${c.user.firstName}  </th> 
                                        <th> ${c.user.location.name}</th> 
                                        <th> ${c.user.mail}</th> 
                                        <th> 
                                            <c:choose>
                                                <c:when test="${!c.user.isAdmin}">
                                                    <a href="<c:url value="/addRight?username="/>${c.user.username}">
                                                        <span class="glyphicon glyphicon-check"></span>
                                                    </a>
                                                </c:when>
                                                <c:otherwise>
                                                    <a href="<c:url value="/removeRight?username="/>${c.user.username}">
                                                        <span class="glyphicon glyphicon-unchecked"></span>
                                                    </a>
                                                </c:otherwise>
                                            </c:choose>
                                        </th> 
                                        <th>
                                            <c:choose>
                                                <c:when test="${c.friend}">
                                                    <span class="glyphicon glyphicon-user"></span> 
                                                </c:when>
                                            </c:choose>
                                        </th>
                                        <th class="hidden"> ${c.user.id}</th> 
                                        </c:forEach>
                                </tr>
                            </tbody>
                        </table>
                    </div>  
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-body">
                    
                </div>
                <div class="panel-footer">
                    <div id="footer">
                        <div id="error"></div>
                        <a href="<c:url value="/chat" /> " id="return-chat">
                            <span class="glyphicon glyphicon-comment"></span>
                            Back to chat page
                        </a>
                        <a href="<c:url value="/home" /> " id="return-home">
                            <span class="glyphicon glyphicon-home"></span>
                            Back to home page
                        </a>
                    </div> 
                </div>
            </div>
            
        </div>  
        
    </body>
</html>
